//
//  CustomError.swift
//  App
//
//  Created by 汤泽川 on 2019/3/26.
//

import Foundation
import Vapor

struct APIError : Error, Codable {
    let status : Int
    let message : String
    
    static let paramError = APIError(status: 1000, message: "请求参数有误")
    static let emptyEmailError = APIError(status: 1001, message: "邮箱不能为空")
    static let sendEmailError = APIError(status: 1002, message: "发送邮件失败")
    static let userExistError = APIError(status: 1003, message: "用户名已存在")
    static let illegalUsernameError = APIError(status: 1004, message: "用户名不合法")
    static let illegalPasswordError = APIError(status: 1005, message: "密码不合法")
    static let emptyVerifyCodeError = APIError(status: 1006, message: "验证码不能为空")
    static let illegalVerifyCodeError = APIError(status: 1007, message: "验证码错误")
    static let illegalAccessTokenError = APIError(status: 1008, message: "权限验证错误\n请重新登陆")
    static let validateAccessTokenError = APIError(status: 1009, message: "权限验证错误\n请重新登录")
    static let validateLoginError = APIError(status: 1010, message: "用户名或密码错误")
    static let userDoesNotExistError = APIError(status: 1011, message: "用户不存在")
    static let resetPasswordError = APIError(status: 1012, message: "用户名和邮箱不匹配")
    static let illegalCommentTarget = APIError(status: 1013, message: "错误的评论对象")
    static let emptyCommentContent = APIError(status: 1014, message: "评论内容不能为空")
}
